home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Misc / Cookie / CookieV1.0 / cookie.filters / bix2cookie.c next >
Encoding:
C/C++ Source or Header  |  1995-06-12  |  518 b   |  30 lines

  1. #include <stdio.h>
  2.  
  3. /* format expected is one cookie per 'line', with @ representing an embedded \n */
  4. void main(int argc, char * argv[])
  5. {
  6.     int c;
  7.     char *title;
  8.     
  9.     if (argc < 2)
  10.         title = "BIX";
  11.     else
  12.         title = argv[1];
  13.             
  14.     c = getchar();
  15.     while (c != EOF) {
  16.         c = getchar();
  17.         printf("#%s%%", title);            /* cookie title */
  18.         while ((c != EOF) && (c != '\n')) {
  19.             /* write cookie */
  20.             if (c == '@')
  21.                 printf("\n ");
  22.             else
  23.                 putchar(c);
  24.             c = getchar();
  25.         }
  26.         putchar('\n');
  27.     }
  28.     
  29.     printf("##\n");        /* end */
  30. }